package com.gxa.dr2.service.impl;

import com.gxa.dr2.dto.Response;
import com.gxa.dr2.dto.ResultDTO;
import com.gxa.dr2.mapper.DeptMapper;
import com.gxa.dr2.pojo.Dept;
import com.gxa.dr2.service.DeptService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DeptServiceImpl implements DeptService {

    @Resource
    private DeptMapper deptMapper;


    /**
     * 部门的所有数据
     *
     * @return
     */
    @Override
    public ResultDTO allData() {
        List<Dept> all = deptMapper.findAll();
        return Response.success(all);
    }

    /**
     * 通过部门的 Id 查询部门信息
     *
     * @param deptId
     * @return
     */
    @Override
    public Dept findById(Integer deptId) {

        return deptMapper.findByPk(deptId);
    }
}
